home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
parsed
/
selfile.frm
< prev
next >
Wrap
Text File
|
1995-05-02
|
4KB
|
142 lines
VERSION 2.00
Begin Form frmSelFile
Caption = "Select Text File To Load"
ClientHeight = 4635
ClientLeft = 1515
ClientTop = 840
ClientWidth = 6285
Height = 5040
Left = 1455
LinkTopic = "Form1"
ScaleHeight = 4635
ScaleWidth = 6285
Top = 495
Width = 6405
Begin CommandButton cmdLoad
Caption = "&Load File"
Height = 375
Left = 1815
TabIndex = 2
Top = 3840
Width = 2340
End
Begin TextBox txtPattern
Height = 315
Left = 435
TabIndex = 6
Top = 450
Width = 2355
End
Begin TextBox txtFile
Height = 315
Left = 420
TabIndex = 7
Top = 3420
Width = 5115
End
Begin DriveListBox Drive1
Height = 315
Left = 2940
TabIndex = 5
Top = 510
Width = 2535
End
Begin DirListBox Dir1
Height = 1830
Left = 2940
TabIndex = 1
Top = 1050
Width = 2535
End
Begin FileListBox File1
Height = 2175
Left = 450
TabIndex = 0
Top = 870
Width = 1905
End
Begin Label Label2
Caption = "Current File:"
Height = 255
Left = 450
TabIndex = 4
Top = 3120
Width = 1755
End
Begin Label Label1
Caption = "File Patterns:"
Height = 255
Left = 480
TabIndex = 3
Top = 90
Width = 1290
End
End
Sub cmdLoad_Click ()
Dim FileNam$, FileContents$, msg$
Dim FileLength&
Screen.MousePointer = HOURGLASS
'get file name and length of selected file
FileNam$ = Trim$(txtFile)
FileLength& = FileLen(FileNam$)
'bail if file too big
If FileLength& > 28000 Then
msg$ = "The file you selected is too large. Please try another file."
MsgBox msg$, MB_ICONINFORMATION
Screen.MousePointer = DEFAULT
File1.SetFocus
Else
'load file and put contents into txtFileContents on frmParse
FileContents$ = LoadFile$(Trim$(txtFile), FileLength&)
frmParse!txtFileContents = FileContents$
'display filename on frmParse
frmParse!lblFileName = FileNam$
'display file length info on frmParse
frmParse!lblFileLen = "Length of File: " & Format$(FileLength&, "##,###") & " bytes."
Unload Me
End If
End Sub
Sub Dir1_Change ()
File1.Path = Dir1.Path
End Sub
Sub Dir1_Click ()
txtFile.Text = ""
End Sub
Sub Drive1_Change ()
Dir1.Path = Drive1.Drive
End Sub
Sub File1_Click ()
Dim i%
For i% = 0 To File1.ListCount - 1
If File1.Selected(i%) = True Then
If Right$(Dir1.Path, 1) = "\" Then
txtFile = File1.Path & File1.List(i%)
Else
txtFile = File1.Path & "\" & File1.List(i%)
End If
Exit For
End If
Next i%
If txtFile <> "" Then cmdLoad.SetFocus
End Sub
Sub Form_Activate ()
Screen.MousePointer = DEFAULT
End Sub
Sub Form_Load ()
Drive1.Drive = "D:\"
File1.Path = Dir1.Path
File1.Pattern = "*.txt"
txtPattern = File1.Pattern
End Sub